package com.scuec.tourismwebsite.service;
//
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.scuec.tourismwebsite.entity.WeatherTip;
import com.scuec.tourismwebsite.mapper.WeatherTipMapper;
import com.scuec.tourismwebsite.vo.ViewWeatherTip;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class WeatherTipServiceImpl implements WeatherTipService{
    private WeatherTipMapper weatherTipMapper;

    public WeatherTipServiceImpl(WeatherTipMapper weatherTipMapper) {
        this.weatherTipMapper = weatherTipMapper;
    }

    @Override
    public PageInfo<ViewWeatherTip> findWeatherTipPages(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<ViewWeatherTip> lists=weatherTipMapper.findWeatherTip();
        PageInfo<ViewWeatherTip> pageInfo=new PageInfo<>(lists);
        return pageInfo;
    }
    @Override
    public List<ViewWeatherTip> findWeatherTip() {
        return weatherTipMapper.findWeatherTip();
    }

    @Override
    public Integer insertWeatherTip(WeatherTip weatherTip) {
        return weatherTipMapper.insertWeatherTip(weatherTip);
    }

    @Override
    public Integer updateWeatherTip(WeatherTip weatherTip) {
        return weatherTipMapper.updateWeatherTip(weatherTip);
    }

    @Override
    public Integer deleteWeatherTip(Integer tip_id) {
        return weatherTipMapper.deleteWeatherTip(tip_id);
    }
}
